﻿#region Creditos

/* Autor: Edilberto Sánchez Forero	*/
/* Email: esanchezfo@gmail.com		*/
/* Licencia: LGPL, Software Libre	*/
/* País: Colombia, Bogotá			*/

#endregion

#region Librerias

using System;
using System.Drawing;

#endregion


namespace ESF.MSExcel
{
	[Serializable]
	public class XlsCell
	{
		#region Miembros
		
		private int _RowIndex;
		private int _ColIndex;
		
		public double OutlineLevel;
		
		public string Comment;
		public string Content;
		
		public Color Background;
		
		#endregion
		
		
		#region Propiedades
		
		public int RowIndex { get { return _RowIndex; } }
		public int ColIndex { get { return _ColIndex; } }
		
		public bool IsEmpty
		{
			get
			{
				return (Background == null || 
					Background == Color.White) &&
					string.IsNullOrEmpty (Content) &&
					string.IsNullOrEmpty (Comment);
			}
		}
		
		
		public bool HasText
		{
			get
			{
				return !string.IsNullOrEmpty (Content);
			}
		}
		
		
		public bool HasComment
		{
			get
			{
				return !string.IsNullOrEmpty (Comment);
			}
		}
		
		#endregion
		
		
		#region Constructor
		
		public XlsCell () {}
		

		public XlsCell (int pRowIndex, int pColIndex)
		 : this (pRowIndex, pColIndex, string.Empty) {}
		

		public XlsCell (int pRowIndex, int pColIndex, string pContent)
		{
			_RowIndex = pRowIndex;
			_ColIndex = pColIndex;
			Content = pContent;
			
			OutlineLevel = 0;
		}
		
		#endregion
		
		
		#region Funciones

		public override string ToString()
		{
			return string.Format ("[{0},{1}] +{4} {2} {3} ({5})", 
				_RowIndex, _ColIndex, 
				Content, Background, OutlineLevel,
				HasComment);
		}
		
		#endregion
	}
}
